/*
 * Tf: a unit test framework for C
 * Copyright (C) 2012 zrezek at gmail.com
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3.0 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
#if !defined TF_PRIVATE_INCLUDED
#define TF_PRIVATE_INCLUDED

#include <setjmp.h>

enum
{
    TEST_EXECUTE_LOCAL,
    TEST_EXECUTE_FORK
};

enum
{
    MODE_DRIVER,
    MODE_RUNNER
};

struct state
{
    struct tf_list fixtures;
    int fixtures_num;

    struct tf_list fixtures_to_run;

    int test_execute_mode;
    int mode;

    // if executing test in the same process
    // this contains address where to jump in
    // case of test failure
    jmp_buf fail_jmp_buf;

    const char* condition;
    const char* file;
    int line;

    // if program was started as remote test runner
    // this holds a fixture / test names to execute
    const char* fixture_to_execute;
    const char* test_to_execute;

    const char* executable_name; // argv[0]
};

extern struct state tf_state;

void tf_invoke_test_local(struct tf_fixture* fixture, struct tf_test* test);

#endif // TF_PRIVATE_INCLUDED
